package chainOfResponsibility.fromKanYun;

public class MyHandler extends AbstractHandler implements Handler{
    private String name;

    public MyHandler(String name) {
        this.name = name;
    }

    @Override
    public void opetator() {
        if (getHandler() !=null){
            System.out.print(name + ", 将BUG交给--->");
            /**
             * 这里是关键：这里不是递归
             * 递归：A(operator)--->A(operator)--->A(operator)
             * 责任链：A(operator)--->B(operator)--->C(operator)
             */
            getHandler().opetator();
        }else {
            System.out.println(name + ", 处理BUG");
        }
    }
}
